<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
// 普通user
        function User(name,pass) {
            this.name = name;
            this.pass = pass;
        }

        User.prototype.showName = function () {
            alert(this.name);
        }
        User.prototype.showPass = function () {
            alert(this.pass);
        }

        //继承
      /*  function VipUser(name,pass,level) {
            //坑蒙拐骗
            User.call(this,name,pass);
            this.level = level;
        }

        VipUser.prototype = new User();
        VipUser.prototype.constructor = VipUser;
        VipUser.prototype.showlevel =function () {
            alert(this.level)
        }
        */

      class VipUser extends User{
            constructor(name,pass, level){
                super(name,pass);
                this.level = level;
            }

            showLevel(){
            	alert(this.level)
            }
        }
        var a = new VipUser('baba',12,99);
      a.showLevel()
    </script>
</head>
<body>

</body>
<script>

</script>
</html>